package com.capgemini.scaffold.enums;

public enum StateEnum {
    CULTURE("1001", "培养中"),
    FORMAL("1002", "转正"),
    OPTIMIZE("1003","已优化");
    private String code;
    private String name;

    //根据code查name
    public static String getNameByCode(String code) {
        for (StateEnum value : StateEnum.values()) {
            if (value.getCode().equals(code)) {
                return value.getName();
            }
        }
        return null;
    }

    //根据name查Code
    public static String getCodeByName(String name) {
        for (StateEnum value : StateEnum.values()) {
            if (value.getName().equals(name)) {
                return value.getCode();
            }
        }
        return null;
    }

    StateEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }
}
